package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortListDemo3 {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
       /* list.add("rose");
        list.add("jerry");
        list.add("coco");
        list.add("jack");
        list.add("kobi");*/
        //Collections.sort(list);
        //System.out.println(list);
        list.add("coco没吃饭");
        list.add("coco没吃饭 想回家");
        list.add("coco meichifan xianghuijia shuijia ");
        list.add("hujsdjkdkjd");
       /* Collections.sort(list);
        System.out.println(list);*/

       Collections.sort(list,(o1,o2)->o1.length()-o2.length());
        System.out.println(list);
        list.sort((o1,o2)->o1.length()-o2.length());




    }
}
